package lesson16;

class Person 

{
	static String courseName = "JavaEE";
	
	public String name;
	String address;
	private final String egn;
	private int age;
	
	private String password;	
	
	City c = new City();
	
	

	
	Person(String egn, String password)
	{
	
		this.egn = egn;
		this.password = password;
	}
	
	void setAge(int age)
	{	
		if (age >= 0 && age < 200)
		this.age = age;
	}
	
	int getAge(String password)
	{
		if(this.password.equals(password))
			return age;
		else
			return -1;
	}
	
	void changeCity(final City newCity)
	{
		c = newCity;
	}
	
	public void changePassword(String oldPassword, String newPassword)
	{
		if (this.password.equals(oldPassword))
			this.password = newPassword;
		else
			System.out.println("Wrong password!");
	}
}
